import { createStore } from 'vuex'
import app from './modules/app'
import user from './modules/user'

import createPersistedstate from 'vuex-persistedstate'



export default createStore({
  plugins: [
    //默认是存储在localStorage中
    createPersistedstate({
      // key: 存储数据的键名
      key: 'vuex',
      //paths:存储state中的那些数据
      paths: ['app', 'user']
    })
  ],
  state: {
  },
  getters: {
    sidebar: (state: any) => state.app.sidebar,
    account: (state: any) => state.user.account,
    username: (state: any) => state.user.username,
    type: (state: any) => state.user.sidebar,
    token: (state: any) => state.user.sidebar,
  },
  mutations: {
  },
  actions: {
  },
  modules: {
    app,
    user
  }
})
